<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xppass Administrator's Control Panel</title>
<LINK href="<?php echo $www_site_url?>/public/yav-style.css" type=text/css rel=stylesheet>
<script src="<?php echo $www_site_url?>/public/js/common.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/calendar.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/ajax.js" type="text/javascript"></script>


<script>
function checkOnSubmit(formName) {

	var url = "<?php echo $www_site_url?>/admin.php";
	var params = mini.form.serialize($(formName));
	mini.ajax.post(url, function(r){
		var r = eval('(' + r + ')');
		if(r.s==200){
			window.location.href = r.d;
		}
		if(r.s==400){
			$('msg').innerHTML = r.m;
		}
	}, params);

	return false;

}
function viewUser(user,user_id){
	var url = "<?php echo $www_site_url?>/admin.php?action=user&view=detail&detail=contact&user_id="+user_id+'&user='+user;
	window.location = url;
//	mini.ajax.get(url, function(r){
//		var r = eval('(' + r + ')');
//		if(r.s==200){
//			$('userid_'+user_id).innerHTML = "<?php echo lang('img')?>:<img src='/public/upload/faceimg/"+r.d.face_img+"' width='60' height='60'>;<?php echo lang('sex')?>:"+r.d.user_sex+ ", <?php echo lang('signup')?>IP:"+ r.d.user_reg_ip +", <?php echo lang('lastlogin')?>:"+r.d.user_lastlogin_time+
//		", <?php echo lang('lastlogin')?>IP:"+r.d.user_lastlogin_ip+" <?php echo lang('email')?>:"+r.d.user_email;
//			$('userid_'+user_id).style.display = 'block';
//		}
//		if(r.s==400){
//			alert(r.m);
//		}
//	});
}
</script>
</head>
<body><div id="append"></div>
<div id="msg" style="color:red;text-align:center"></div>



	<script type="text/javascript">
	function setTab(n){
		document.getElementById("tabs_mainbox").style.display = 'block';
		document.getElementById("close").style.display = 'block';
		var tli=document.getElementById("tabs_menu").getElementsByTagName("li");
		var mli=document.getElementById("tabs_main").getElementsByTagName("div");
		for(i=0;i<tli.length-1;i++){
		  tli[i].className=i==n?"hover":"";
		  mli[i].style.display=i==n?"block":"none";
		}
	}
	function hid(){
		document.getElementById("tabs_mainbox").style.display = 'none';
		document.getElementById("close").style.display = 'none';
		var tli=document.getElementById("tabs_menu").getElementsByTagName("li");
		for(i=0;i<tli.length;i++){
		  tli[i].className="";
		}
	}


	</script>

	<div class="container">


			<div id="tabs">
				<div class="tabs_menubox">
					<ul id="tabs_menu">
						<li onclick="setTab(0)"><?php echo lang('search_user')?></li>
						<li onclick="setTab(1)"><?php echo lang('add_user')?></li>
						<li onclick="hid()" id="close" style="display:none;"><?php echo lang('hide')?>×</li>

					</ul>
				</div>
				<div id="tabs_mainbox" class="tabs_mainbox" style="display:none;">
					<div class="main" id="tabs_main" >
						<div  style="display:none;">
							<form action="<?php echo $www_site_url?>/admin.php" method="GET">
							<input type="hidden" name="action" value="user">
							<input type="hidden" name="view" value="defaults">
							<table width="100%">
								<tr>
									<td align="right"><?php echo lang('user')?>:</td>
									<td align="left"><input type="text" name="user" value="<?php echo $con['user']?>" class="textfield" /></td>

									<td>UID:</td>
									<td align="left"><input type="text" name="user_id" value="<?php echo $con['user_id']?>" class="textfield" /></td>
									<td><?php echo lang('nickname')?>:</td>
									<td align="left"><input type="text" name="user_nickname" value="<?php echo $con['user_nickname']?>" class="textfield" /></td>
									<td rowspan="2"><input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>
								</tr>
								<tr>
									<td align="right"><?php echo lang('reg_date')?>:</td>

									<td colspan="3" align="left"><input type="text" name="user_reg_time" onclick="showcalendar();" value="<?php echo $con['user_reg_time']?>" class="textfield" /> <?php echo lang('to')?> <input type="text" name="user_reg_time1" onclick="showcalendar();" value="<?php echo $con['user_reg_time1']?>" class="textfield" /></td>

								</tr>
								<tr>
									<td align="right"><?php echo lang('realname')?>:</td>
									<td align="left"><input type="text" name="realname" value="<?php echo $con['realname']?>" class="textfield" /></td>
									
									<td align="right"><?php echo lang('province')?>:</td>
									<td align="left"><input type="text" name="province" value="<?php echo $con['province']?>" class="textfield" /></td>
									
									<td align="right"><?php echo lang('city')?>:</td>
									<td align="left"><input type="text" name="city" value="<?php echo $con['city']?>" class="textfield" /></td>
									
									<td align="right"><?php echo lang('district')?>:</td>
									<td align="left"><input type="text" name="area" value="<?php echo $con['area']?>" class="textfield" /></td>
								</tr>
							</table>
							</form>
						</div>
						<div class="block" style="display:none;">
							<form id="adduserform" name="adduserform" action="<?php echo $www_site_url?>/admin.php" method="post" onsubmit="return checkOnSubmit('adduserform');" >
							<input type="hidden" name="action" value="user">
							<input type="hidden" name="op" value="adduser">
							<input type="hidden" name="reg_type" value="email">
							<table width="100%">
								<tr>
									<td align="left"><?php echo lang('user')?>:</td>
									<td align="left"><input type="text" name="email" class="textfield" /></td>

									<td><?php echo lang('pwd')?>:</td>
									<td align="left"><input type="password" name="password" class="textfield" /></td>
									<td><?php echo lang('nickname')?>:</td>
									<td align="left"><input type="text" name="nickname" class="textfield" /></td>
									<td><?php echo lang('sex')?>:</td>
									<td align="left"><input type="radio" name="sex" value="1"/><?php echo lang('boy')?> &nbsp;&nbsp;<input type="radio" name="sex" value="2"/><?php echo lang('girl')?></td>
									<td><input type="submit" value="<?php echo lang('submit')?>" class="button"/></td>
								</tr>
							</table>
							</form>

						</div>

				</div>
			</div>

		</div>
<br>
		<h3><?php echo lang('user_list')?> <?php echo lang('user_total')?>:<?php echo $total?></h3>

		<div class="mainbox">
				<form action="<?php echo $www_site_url?>/admin.php" onsubmit="return confirm('<?php echo lang('domain_delete_comfirm')?>');" method="post">
				<input type="hidden" name="action" value="user">
				<input type="hidden" name="op" value="deluser">
				<table class="datalist fixwidth" onmouseover="addMouseEvent(this);" >

					<tr>
						<th><input type="checkbox" name="chkall" id="chkall" onclick="checkall('delete[]')" class="checkbox" /><label for="chkall"><?php echo lang('delete')?></label></th>

						<th><?php echo lang('user')?></th>
						<th><?php echo lang('nickname')?></th>
						<th><?php echo lang('realname')?></th>
						<th><?php echo lang('reg_date')?></th>
						<th><?php echo lang('completetask')?></th>
						<th><?php echo lang('more')?></th>

						<th><?php echo lang('edit')?></th>
					</tr>
						<?php if(isset($users['records']) && is_array($users['records'])){
							foreach ($users['records'] as $v){?>
						<tr>
							<td class="option"><input type="checkbox" name="delete[]" value="<?php echo $v['user']?>" class="checkbox" /></td>

							<td><strong><?php echo $v['user']?></strong></td>
							<td><?php echo $v['user_nickname']?></td>
							<td><?php echo $v['realname']?></td>
							<td><?php echo date('y-m-d H:i:s',$v['user_reg_time'])?></td>
							<td><?php echo $v['count']?></td>

							<td><a href="javascript:viewUser('<?php echo $v['user']?>','<?php echo $v['user_id']?>')"><?php echo lang('view')?></a></td>
							<td><a href="/admin.php/user/edit/user_id/<?php echo $v['user_id']?>/user/<?php echo $v['user']?>"><?php echo lang('edit')?></a></td>
						</tr>
						<tr>
						<td colspan="7"><div style="display:none" id="userid_<?php echo $v['user_id']?>"></div></td>
						</tr>

						<?php }
						}?>
										<tr class="nobg">
						<td><input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>
						<td class="tdpage" colspan="7" align="right"><div class="pages"><?php echo $users['pagebar']?></div></td>
					</tr>
				</table>

				</form>
					</div>
					<p style="color:#666;font-size:12px"><?php echo lang('admin_remind')?></p>
	</div>

</body>
</html>